package com.umgsai.thread.thread35;

import java.io.PipedInputStream;
import java.io.PipedOutputStream;

public class Main {
	public static void main(String[] args) {
		try {
			WriteData writeData = new WriteData();
			ReadData readData = new ReadData();
			
			PipedInputStream inputStream = new PipedInputStream();
			PipedOutputStream outputStream = new PipedOutputStream();
			
			outputStream.connect(inputStream);
			
			ThreadRead threadRead = new ThreadRead(readData, inputStream);
			ThreadWrite threadWrite = new ThreadWrite(writeData, outputStream);
			
			threadRead.start();
			
			Thread.sleep(1000);
			
			threadWrite.start();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
